package com.yihuan.service;

import com.yihuan.entity.UserEntity;
import com.yihuan.mapper.UserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Author:梦醒
 * Date: 2022/4/19 17:31
 * Dream:
 * 信言不美，美言不信。
 * 善者不辩，辩者不善。
 * 知者不博，博者不知。
 * Function:
 */
@Service
public class UserService {
    @Resource
    UserMapper userMapper;
    
    /**
     * 根据管理员账号和密码
     *
     * @param userEntity
     * @return
     */
    public List<UserEntity> findUserByUserLoginNameAndUserPassword(UserEntity userEntity) {
        return userMapper.findUserByUserLoginNameAndUserPassword(userEntity);
    }
    
    /**
     * 分页查询数据
     *
     * @param userEntity
     * @return
     */
    public List<UserEntity> findUserByUserList(UserEntity userEntity) {
        return userMapper.findUserByUserList(userEntity);
    }
    
    /**
     * 统计分页查询数据
     *
     * @return
     */
    public int countUserList(UserEntity userEntity) {
        return userMapper.countUserList(userEntity);
    }
    
    /**
     * 模糊分页查询数据
     *
     * @param userEntity
     * @return
     */
    public List<UserEntity> findUserByUserConcatList(UserEntity userEntity) {
        return userMapper.findUserByUserConcatList(userEntity);
    }
    
    /**
     * 模糊统计分页查询数据
     *
     * @param userEntity
     * @return
     */
    public int countUserConcatList(UserEntity userEntity) {
        return userMapper.countUserConcatList(userEntity);
    }
    
    /**
     * 更改信息启用状态
     *
     * @param userEntity
     * @return
     */
    public int updateUserByUserState(UserEntity userEntity) {
        return userMapper.updateUserByUserState(userEntity);
    }
    
    /**
     * 更改信息删除状态
     *
     * @param userEntity
     * @return
     */
    public int updateUserByUserDeleteState(UserEntity userEntity) {
        return userMapper.updateUserByUserDeleteState(userEntity);
    }
    
    /**
     * 根据回收员和用户账号和密码
     *
     * @param userEntity
     * @return
     */
    public List<UserEntity> findUserByUserLoginNameAndUserPasswordAndSellerID(UserEntity userEntity) {
        return userMapper.findUserByUserLoginNameAndUserPasswordAndSellerID(userEntity);
    }
    
    /**
     * 根据账号判断是否存在
     *
     * @param userEntity
     * @return
     */
    public List<UserEntity> findUserByUserLoginNameData(UserEntity userEntity) {
        return userMapper.findUserByUserLoginNameData(userEntity);
    }
    
    /**
     * 注册用户信息
     *
     * @param userEntity
     * @return
     */
    public int insertUserByUserData(UserEntity userEntity) {
        return userMapper.insertUserByUserData(userEntity);
    }
    
    /**
     * 以用户编号查询
     *
     * @param userEntity
     * @return
     */
    public List<UserEntity> findUserByUserID(UserEntity userEntity) {
        return userMapper.findUserByUserID(userEntity);
    }
    
    /**
     * 查询用户对应公司编号
     *
     * @param userEntity
     * @return
     */
    public List<UserEntity> findUserByUserIDData(UserEntity userEntity) {
        return userMapper.findUserByUserIDData(userEntity);
    }
    
    
    /**
     * 统计用户数据
     *
     * @return
     */
    public int countUser() {
        return userMapper.countUser();
    }
}
